package com.deke.baby.service.impl;

import java.util.List;
import com.deke.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.deke.baby.mapper.BabyActivityMapper;
import com.deke.baby.domain.BabyActivity;
import com.deke.baby.service.IBabyActivityService;

/**
 * 活动Service业务层处理
 *
 * @author deke
 * @date 2023-06-28
 */
@Service
public class BabyActivityServiceImpl implements IBabyActivityService
{
    @Autowired
    private BabyActivityMapper babyActivityMapper;

    /**
     * 查询活动
     *
     * @param id 活动主键
     * @return 活动
     */
    @Override
    public BabyActivity selectBabyActivityById(Long id)
    {
        return babyActivityMapper.selectBabyActivityById(id);
    }

    /**
     * 查询活动列表
     *
     * @param babyActivity 活动
     * @return 活动
     */
    @Override
    public List<BabyActivity> selectBabyActivityList(BabyActivity babyActivity)
    {
        return babyActivityMapper.selectBabyActivityList(babyActivity);
    }

    /**
     * 新增活动
     *
     * @param babyActivity 活动
     * @return 结果
     */
    @Override
    public int insertBabyActivity(BabyActivity babyActivity)
    {
        babyActivity.setCreateTime(DateUtils.getNowDate());
        return babyActivityMapper.insertBabyActivity(babyActivity);
    }

    /**
     * 修改活动
     *
     * @param babyActivity 活动
     * @return 结果
     */
    @Override
    public int updateBabyActivity(BabyActivity babyActivity)
    {
        babyActivity.setUpdateTime(DateUtils.getNowDate());
        return babyActivityMapper.updateBabyActivity(babyActivity);
    }

    /**
     * 批量删除活动
     *
     * @param ids 需要删除的活动主键
     * @return 结果
     */
    @Override
    public int deleteBabyActivityByIds(Long[] ids)
    {
        return babyActivityMapper.deleteBabyActivityByIds(ids);
    }

    /**
     * 删除活动信息
     *
     * @param id 活动主键
     * @return 结果
     */
    @Override
    public int deleteBabyActivityById(Long id)
    {
        return babyActivityMapper.deleteBabyActivityById(id);
    }
}
